package com.zzc.legou.search.clients;

import com.zzc.legou.item.entity.Sku;
import com.zzc.service.item.api.SkuApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@FeignClient(name = "item-service", fallback = SkuClient.SkuClientFallBack.class)
public interface SkuClient extends SkuApi {


    @Component
    @RequestMapping("/sku-fallback")
    class SkuClientFallBack implements SkuClient {
        private static final Logger LOGGER = LoggerFactory.getLogger(SkuClientFallBack.class);

        @Override
        public List<Sku> selectSkusBySpuId(Long spuId) {
            LOGGER.error("查询sku信息失败");
            return null;
        }
    }
}
